/* Custom Meta for JNews - Module 3 || Add Category */
function custom_post_meta_1_module_3( $output, $post, $instance ) {
if ( get_class( $instance ) === 'JNews\Module\Block\Block_3_View' ) {
$output = '';
$block_3_class = JNews\Module\Block\Block_3_View::getInstance();
if ( get_theme_mod( 'jnews_show_block_meta', true ) ) {
$comment = jnews_get_comments_number( $post->ID );
$view_count = jnews_meta_views( $post->ID );
// author detail
$author = isset( $post->post_author ) ? $post->post_author : 'rss_post';
$is_rss = jnews_get_rss_post_id( $author );
$author_url = $is_rss ? ( isset( $post->post_author_url ) ? $post->post_author_url : '' ) : get_author_posts_url( $author );
$author_name = $is_rss ? $post->post_author_name : get_the_author_meta( 'display_name', $author );
$author_avatar = ( $is_rss ? false : $avatar) ?
'
' . get_avatar( get_the_author_meta( 'ID', $post->post_author ), 80, null, get_the_author_meta( 'display_name', $post->post_author ) ) . '
' : '';
$trending = ( vp_metabox( 'jnews_single_post.trending_post', null, $post->ID ) ) ? "" : "";
if ( jnews_is_review( $post->ID ) ) {
$rating = jnews_generate_rating( $post->ID, 'jeg_landing_review' );
$output .= "";
$output .= $trending;
$output .= get_theme_mod( 'jnews_show_block_meta_rating', true ) ? $rating : "";
$output .= get_theme_mod( 'jnews_show_block_meta_author', true ) ? ( jnews_check_coauthor_plus() ? "
" . jnews_get_author_coauthor( $post->ID, false, 'by', 1 ) . "
" : "
" ) : "";
/* Start Custom */
$output .= "
";
$output .= " In " . $block_3_class->get_primary_category ($post->ID ) . "";
$output .= "
";
/* End Custom */
$output .= "
";
} else {
$output .= "";
$output .= $trending;
$output .= get_theme_mod( 'jnews_show_block_meta_author', true ) ? ( jnews_check_coauthor_plus() ? "
" . jnews_get_author_coauthor( $post->ID, $avatar, 'by', 1 ) . "
" : "
" ) : "";
$output .= get_theme_mod( 'jnews_show_block_meta_date', true ) ? "
" : "";
$output .= get_theme_mod( 'jnews_show_block_meta_comment', true ) && ! $feed ? "" : "";
$output .= get_theme_mod( 'jnews_show_block_meta_views', false ) && ! $feed ? "
" : "";
/* Start Custom */
$output .= "
";
$output .= " In " . $block_3_class->get_primary_category ($post->ID ) . "";
$output .= "
";
/* End Custom */
$output .= "
";
}
}
return $output;
}
return $output;
}
add_filter( 'jnews_module_post_meta_1', 'custom_post_meta_1_module_3', null, 3 );